package com.ki.erp.controller;

import cn.idev.excel.FastExcel;
import com.ki.erp.dao.EmployeeDaoImpl;
import com.ki.erp.req.GetStaticStatementReq;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/excel")
public class ExcelController {
    private @Resource EmployeeDaoImpl employeeDao;


    @PostMapping("/GetResignWorker")
    public void handle(@RequestBody GetStaticStatementReq req, HttpServletResponse response) throws IOException {
        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        response.setHeader("Content-Disposition", "attachment; filename=" + req.getName() + ".xlsx");
        response.setCharacterEncoding("utf-8");
//        FastExcel.write(response.getOutputStream(), DemoData.class)
//                .sheet("sheet1")
//                .doWrite(data());

    }
}
